<?php

namespace App\Commons\Domain\Module\UserCenter\Contract;

use App\Commons\Domain\Module\UserCenter\Model\Admin;
use App\Commons\Domain\Module\UserCenter\Model\Member;

interface AccountService
{
    /**
     * 用户注册
     * @param string $username
     * @param string $password
     * @param string $mobile
     * @param int $country_id
     * @param string $email
     * @return mixed
     */
    public function createUser(string $username, string $password, string $mobile, int $country_id, string $email = '');

    /**
     * 创建管理员
     * @param string $username
     * @param string $password
     * @param string $mobile
     * @return mixed
     */
    public function createAdmin(string $username, string $password);

    /**
     * 修改用户信息
     * @param Member $user 当前登陆用户
     * @param string $nickname
     * @param string $avatar
     * @param int $gender
     * @return bool
     */
    public function updateUserInfo(Member $user, string $nickname, string $avatar, int $gender = 0);

    /**
     * 忘记密码，重设密码
     * @param string $mobile
     * @param string $new_password
     * @param string $email
     * @return mixed
     */
    public function forgotPassword(string $mobile, string $new_password, string $email = '');

    /**
     * 用户登录
     * @param Member $member 会员模型
     * @param string $ip 登录地址
     * @return [type]         [description]
     */
    public function userLogin(Member $member, string $ip = null);

    /**
     * 管理员登录 admin
     * @param Admin $admin [description]
     * @param string|null $ip [description]
     * @return [type]              [description]
     */
    public function adminLogin(Admin $member, string $ip = null);

    /**
     * 用户信息
     * @param Member $member 会员模型
     * @return [type]         [description]
     */
    public function userInfo(Member $member);

    /**
     * 用户退出登录
     * @param string $token 用户token
     * @return [type]        [description]
     */
    public function userLogout(string $token);

    /**
     * 移除登录缓存
     * @param Member $member [description]
     * @return [type]         [description]
     */
    public function forgetLoginInfo(Member $member);


    /**
     * 修改通知状态
     * @param Member $user 会员模型
     * @param string $field 修改类
     * @param int $status 修改值
     * @return mixed
     */
    public function switchNotice(Member $user, string $field, int $status);

    /**
     * 修改用户资金密码
     * @param Member $member
     * @param string $password
     * @param string $password_repeat
     * @return mixed
     */
    public function changePwd(Member $member, string $password,string $password_repeat);


}
